package com.iawg.attrition.engine;

import com.iawg.attrition.engine.command.Command;
import com.iawg.attrition.engine.messaging.BasicMessage;
import com.iawg.attrition.engine.messaging.BasicMessageHandler;
import com.iawg.attrition.engine.renderer.BasicRenderer;

public abstract class BasicEngine extends Engine<BasicRenderer, BasicMessageHandler, BasicMessage> {

	protected BasicEngine(BasicRenderer renderer, BasicMessageHandler messageHandler) {
		super(renderer, messageHandler);
	}
	
	protected void processMessage(BasicMessage message) {
		switch (message.prefix) {
		case COMMAND:
			((Command<?,?,?>) message.body).performCommand();
			break;
		case RESOURCE_LOAD:
			load(message.body);
			break;
		case RESOURCE_RELEASE:
			release(message.body);
			break;
		default:
			break;
		}
	}
}